Skip to content

perf(io): consume the receive buffer ring incrementally - #164

Merged
lexoliu merged 2 commits into
mainfrom
perf/163-buffer-ring-inc
Nov 11, 2026
Merged

lexoliu merged 2 commits into
mainfrom
perf/163-buffer-ring-inc

Conversation

@lexoliu

@lexoliu lexoliu commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Moves the compio dependency onto the skyzen branch of a compio fork (v0.19.2 plus the changes offered upstream as compio-rs/compio#1140, #1141 and #1142, and one more for incremental consumption), and receives through an incrementally consumed ring where the kernel supports it.

On such a ring (IOU_PBUF_RING_INC, Linux 6.12) a completion lends only the bytes it filled, starting where the previous completion into that buffer ended, and the buffer goes back to the ring only once a completion without IORING_CQE_F_BUF_MORE took it out and the last reference into it drops. A kernel that rejects the flag gets whole-buffer consumption, decided by compio when the ring registers. The ring tests run on both paths; a new one holds eight 16-byte reads from a two-buffer ring and checks each starts where the previous ended.

Closes #163

The branch carries the io_uring changes the receive path needs ahead of a
compio release: IORING_CQE_F_BUF_MORE through Extra, a buffer pool that
recycles incrementally consumed buffers only once the kernel is done, the
second half of 32-byte CQEs and zero-copy notification results.
A multishot receive used a whole ring buffer per completion, however few
bytes arrived. On a ring registered with IOU_PBUF_RING_INC the kernel now
fills a buffer across completions, so small reads share a buffer instead
of draining the ring; compio lends each read its part and recycles the
buffer once the kernel is done and every part is released. Kernels before
6.12 reject the flag at registration, and the ring consumes whole buffers.

The ring tests run on both consumption modes, and a new test checks that
consecutive small reads of a connection continue in one buffer.

Closes #163
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lexoliu
lexoliu merged commit e840eb9 into main Nov 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

io: consume the receive buffer ring incrementally on io_uring

2 participants